<!DOCTYPE html>
<html>
<head>
  <!-- <script src='https://cloud.tinymce.com/stable/tinymce.min.js'></script> -->
  <!-- <script src="https://cdn.bootcss.com/tinymce/4.9.2/tinymce.min.js"></script> -->
  <!-- <script src="https://panjiachen.gitee.io/vue-element-admin/static/tinymce4.7.5/tinymce.min.js"></script> -->
  <script src="./tinymce/tinymce.min.js"></script>
  <script>
var toolbar = ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent  blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen'];

const plugins = ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'];



  tinymce.init({
    selector: '#mytextarea',
    toolbar: toolbar,
    plugins: plugins,
    language: "zh_CN",
    // without images_upload_url set, Upload tab won't show up
    images_upload_url: 'postAcceptor.php',

    // we override default upload handler to simulate successful upload
    images_upload_handler: function (blobInfo, success, failure) {
      
      var xhr, formData;
      xhr = new XMLHttpRequest();
      xhr.withCredentials = false;
      xhr.open('POST', 'postAcceptor.php');
      xhr.onload = function() {
        var json;

        if (xhr.status != 200) {
          failure('HTTP Error: ' + xhr.status);
          return;
        }
        json = JSON.parse(xhr.responseText);

        if (!json || typeof json.location != 'string') {
          failure('Invalid JSON: ' + xhr.responseText);
          return;
        }
        success(json.location);
      };
      formData = new FormData();
      formData.append('file', blobInfo.blob(), blobInfo.filename());
      xhr.send(formData);
    },

  });
  </script>
</head>

<body>
<h1>TinyMCE Quick Start Guide</h1>
  <form method="post">
    <textarea id="mytextarea">Hello, World!</textarea>
  </form>
</body>
</html>